package cn.adkii.springframework.context.support;

import cn.adkii.springframework.beans.BeansException;

/**
 * @author malingdi
 * @description 应用上下文实现类
 * @date 2023/11/23 18:39
 */
public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContext {

    private String[] configLocations;

    public ClassPathXmlApplicationContext() {
    }

    /**
     * 从XML中加载BeanDefinition, 并刷新上下文
     * @param configLocations
     */
    public ClassPathXmlApplicationContext(String[] configLocations) {
        this.configLocations = configLocations;
        refresh();
    }


    /**
     * 从XML中加载BeanDefinition, 并刷新上下文
     * @param configLocations
     * @throws BeansException
     */
    public ClassPathXmlApplicationContext(String configLocations) throws BeansException {
        this(new String[]{configLocations});
    }
    @Override
    protected String[] getConfigLocation() {
        return configLocations;
    }
}
